{$form|raw}
<script>
    layui.use(['layer', 'form', 'admin', 'formX', 'authtree'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;
        var authtree = layui.authtree;
        var mUser = admin.getLayerData('#role');  // 列表页面传递的数据，#modelUserForm这个只要写弹窗内任意一个元素的id即可
        // 回显数据
        form.val('role', mUser);
        // 表单提交事件
        form.on('submit(submitRole)', function (data) {
            admin.req('{:url("role")}', data.field, function (response) {
                    layer.msg(response.msg, {icon: 1});
                    admin.putLayerData('formOk', true, '#role');  // 设置操作成功的标识，#modelUserForm这个只要写弹窗内任意一个元素的id即可
                    admin.closeDialog('#role');  // 关闭页面层弹窗
            }, 'post');
            return false;
        });
        admin.req('{:url("/role/get/permissions")}',{parent_id:"{$parent_id}"}, function (response) {
            authtree.render('#permissions', response.data.permissions,{
                inputname: 'permissionids[]',
                layfilter: 'lay-check-auth',
                autowidth: true,
                nameKey: 'permission_name',
                valueKey: 'id',
                childKey: 'children',
                collapseLeafNode: true,
                theme: 'auth-skin-default',
            });
        })

    });
</script>